package com.app.web;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;

public class HtmlSource
{
    /**
     * ����Դ��
     * 
     * @param Url
     * @param FontSize
     * @return 
     * @throws Exception 
     * @throws ClientProtocolException
     */
    public static String getHtml_data(String Url) throws Exception
    {

        // 页面源码
        String resourseStr = null;
        
        // httpclent客户端
        HttpClient httpClient = HttpClientFactory.getHttpClient();

        HttpGet httpget = new HttpGet(Url);
        
        HttpResponse response = httpClient.execute(httpget);
        HttpEntity entity= response.getEntity();


        if(entity == null)
        {
            throw new Exception("entity is null");
        }
        
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                entity.getContent()));

        resourseStr = reader.readLine();
        
        if (resourseStr == null)
        {
            throw new Exception("resourseStr is null");
        }
        return resourseStr;
    }

}
